package com.example.libary.exception;

import com.example.libary.common.ResultCode;
import lombok.Getter;

/**
 * 业务异常类
 */
@Getter
public class BusinessException extends RuntimeException {
    
    /**
     * 状态码
     */
    private final Integer code;
    
    /**
     * 消息
     */
    private final String message;
    
    /**
     * 构造方法
     *
     * @param resultCode 结果码
     */
    public BusinessException(ResultCode resultCode) {
        this.code = resultCode.getCode();
        this.message = resultCode.getMessage();
    }
    
    /**
     * 构造方法
     *
     * @param code    状态码
     * @param message 消息
     */
    public BusinessException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
} 